<?php
/**
 * Plotter per il grafico "OutdoorWetBulb"
 */
Zend_Loader::loadClass("Application_Plotter_Base");
Zend_Loader::loadClass("Application_PlotData");
Zend_Loader::loadClass('Output_Time');
Zend_Loader::loadClass('Output_ReportVariableData');
Zend_Loader::loadClass('Output_ReportVariableDataDictionary');

class OutdoorWetBulb extends Application_Plotter_Base
{
	public function call() {
	$stmt = $this->_db->query('
				SELECT Month, Day, Hour, Minute, VariableValue
				FROM ReportVariableData
				INNER JOIN ReportVariableDataDictionary ON ReportVariableData.ReportVariableDataDictionaryIndex=ReportVariableDataDictionary.ReportVariableDataDictionaryIndex
				INNER JOIN Time ON ReportVariableData.TimeIndex = Time.TimeIndex
				WHERE ReportVariableDataDictionary.VariableName = ?'
	, array ("Outdoor Wet Bulb"));
	$results = $stmt->fetchAll($query);
	//AND Time.EnvironmentPeriodIndex = ?',
	if (!empty($results)) {
		foreach ($results as &$result) {
			$dataPoints[] = (float) $result['VariableValue'];
			$timestamp = mktime(0, 0, 0, $result['Month'], $result['Day'], 2005);
			$x[] = date("d-M", $timestamp);
		}
		$plotData = new Application_PlotData("Outdoor Wet Bulb");
		$plotData->setXAxis($x, "s", "Ascissa", "Tempo di Simulazione");
		$plotData->setYAxis(null, "°C", "Ordinate", "Temperatura");
		$plotData->addSerie($dataPoints, "°C", "Serie 1", "Outdoor Wet Bulb");
	
		return $plotData;
	}
	}
	}
	